import 'package:flutter/material.dart';

class AlignView extends StatelessWidget {
  const AlignView({super.key});

  final List<Alignment> alignments = const [
    Alignment.topLeft,
    Alignment.topCenter,
    Alignment.topRight,
    Alignment.centerLeft,
    Alignment.center,
    Alignment.centerRight,
    Alignment.bottomLeft,
    Alignment.bottomCenter,
    Alignment.bottomRight,
  ];

  final List<String> alignmentsInfo = const [
    "topLeft",
    "topCenter",
    "topRight",
    "centerLeft",
    "center",
    "centerRight",
    "bottomLeft",
    "bottomCenter",
    "bottomRight",
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: getContent(),
      ),
    );
  }

  Widget getContent2() {
    return Container(width: double.infinity, height: 200,color: Colors.blueAccent, child:
    Align(
      alignment: Alignment.center,
      child: Container(
        width: 30,
        height: 30,
        color: Colors.cyanAccent,
      ),
    ),);
  }

  Widget getContent() {
    return Wrap(
      children:
      alignments
          .toList()
          .map(
            (mode) => Column(
          children: [
            Container(
              margin: EdgeInsets.all(5),
              width: 100,
              height: 60,
              color: Colors.blueAccent,
              child: Align(
                alignment: mode,
                child: Container(
                  width: 30,
                  height: 30,
                  color: Colors.cyanAccent,
                ),
              ),
            ),
            Text(
              alignmentsInfo[alignments.indexOf(mode)],
              style: TextStyle(fontSize: 10),
            ),
          ],
        ),
      )
          .toList(),
    );
  }
}
